package org.example.myleet.p384;

import org.example.myleet.Utils.JsonUtils;

public class Main {
    public static void main(String[] args) {
        int[] sample = new int[]{0,1,2,3,4};
        int[][] counts = new int[sample.length][sample.length + 1];
        Solution2 solution = new Solution2(sample);
        for (int i = 0; i < 10000; ++i) {
            solution.reset();
            int[] shuffled = solution.shuffle();
            for (int j = 0; j < sample.length; ++j) {
                ++counts[j][shuffled[j]];
            }
        }
        for (int i = 0; i < sample.length; ++i) {
            for (int j = 0; j < sample.length; ++j) {
                counts[i][sample.length] += counts[i][j];
            }
        }
        System.out.println(JsonUtils.toJson(counts));
    }
}
